home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 11988 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  5.6 KB

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++
  4. Subject: Re: C/C++ knocks the crap out of Ada
  5. Date: 17 Mar 1996 08:36:24 -0800
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4ihf28INNsob@keats.ugrad.cs.ubc.ca>
  8. References: <00001a73+00002504@msn.com> <4idh80$6tj@solutions.solon.com> <4idk8oINNrr2@keats.ugrad.cs.ubc.ca> <4if97t$1cqm@saba.info.ucla.edu>
  9. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  10.  
  11. In article <4if97t$1cqm@saba.info.ucla.edu>,
  12. Jay Martin <jmartin@cs.ucla.edu> wrote:
  13.  >c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku) writes:
  14.  >
  15.  >> >Like all tools, lex and yacc are excellent for some tasks, and useless
  16.  >> >for others.  I can only assume you've been trying to use them for
  17.  >> >inappropriate tasks, or more likely, that you haven't ever used them,
  18.  >> >and that you're not familiar with C, either.  You've posted many
  19.  >> >claims, with *no* documentation, *no* examples, and *no* rationale.
  20.  >
  21.  >>That trick allows an author to retreat infinitely without admitting he is
  22.  >>wrong, because there is no wall to back into.  ``But I never said this or
  23.  >>that...''. Of course not. Didn't say a damn thing, in fact.  Without the
  24.  >>documentation, examples and whatnot, it is just *.advocacy fluff.
  25.  >
  26.  >Alright dumbshits lesson time:
  27.  >
  28.  >  -- Tools and operating systems that only support one language are junk.
  29.  >     Basic computer science, anyone who thinks otherwise is incompetent.
  30.  
  31. What operating systems are those? Clearly you can't be talking about UNIX which
  32. supports too many languages for me to even try to enumerate (including Ada).
  33.  
  34.  >  -- Stupidly go on and on about how an certain IO routine is not as fast
  35.  >     as Lex, not too swift.  (1) Won't matter if your reading in 1K.
  36.  >     (2) Just shows the IO routine is broken.  Its trivia.
  37.  
  38. Why does it show the IO routine is broken? Maybe it shows that flex generated
  39. programs (it was GNU flex that made the faster code---lex's was _slightly_
  40. slower) programs are in fact faster. Why do you assume that the IO routine
  41. must necessarily be broken if it can't outperform a flex program? Have you
  42. actually _looked_ at the the body of a flex program before spouting off?
  43.  
  44. As soon as you do anything less trivial than just scanning a bunch of numbers,
  45. lex-generated programs  quickly become faster than the standard scanf()
  46. routine.  The scanf() routine has to interpret its format string each time it
  47. is invoked. On the other hand, lex generates a static table.
  48. Suppose I have just a few keywords to match:
  49.  
  50. "foo"     { }
  51. "bar"    { }
  52. "lex"    { }
  53.  
  54. If I used scanf(), I would have to extract a token, and then do a search to
  55. find which of the keywords it matches using hashing or what have you.
  56. A lex program doesn't have to do that since when its automaton arrives at an
  57. acceptance state, it knows which keyword has been matched. It matches them all
  58. simultaneously.
  59.  
  60. My performance test (which I ran on three machines/operating systems, not just
  61. one) showed that even for scanning a simple file of numbers, the lex program
  62. was no less efficient than the IO routine scanf(), while the one generated by
  63. flex from the same specification was twice as fast.
  64.  
  65.  >  -- Go on and on how its great to over-engineer something simple.
  66.  >     How great it is to be a "savant" at a criptic tool with little
  67.  
  68. Cryptic tool in your eyes. A compiler is also a cryptic tool to someone who
  69. doesn't ``speak'' the language. So is a text editor, etc. You train to learn
  70. these things. You think that lex and yacc mastery is congenital? I learned by
  71. taking a course, reading books and documentation, and, of course, practice. The
  72. same way I learned everything else in computing. Programming languages,
  73. operating systems, tools, etc. Just because you are not willing to put in the
  74. extra effort doesn't mean that you have to denigrate the skills learned by
  75. others who are willing to put in the effort. You surely must have put out
  76. _some_ effort to get where you are, wherever that may be.
  77.  
  78.  >     eye to the effects of using that tool to the maintainability
  79.  >     of the software.  This is called "eat shit next guy" hacking.
  80.  
  81. In the past I have had to modify some programs that embodied yacc parsers. I
  82. found it quite easy. One time I was looking for a bug the ``tcpdump'' utility.
  83. Bacause its expression compiler was done with yacc, the task was made all the
  84. simpler. The program was far more understandable to me. I rejoiced at the
  85. program's nice layout---far from feeling like the programmers had the above
  86. sentiment toward me, the next guy.
  87.  
  88.  >Of course when you tell of maintainance headaches caused by abuse of
  89.  >these tools do to they are ready availability and it is supposed to be
  90.  >so cool to use them.  Then its the usual C/Unix hacker macho attitude
  91.  >of "they are just lame programmers" the tools are great!  
  92.  
  93. What does ``cool'' and ``macho'' have to do anything? Get out of puberty!
  94. Are you suffering from some kind of inferiority complex?
  95.  
  96.  >The Unix philosophy is great for the quick hack, but for larger
  97.  >software development the philosophy becomes counter productive.
  98.  
  99. I think you are stretching your little lex and yacc slam a little too far.
  100.  
  101. You are also contradicting yourself.  A ``quick hack'' is an activity
  102. diametrically opposed to ``over-engineering something simple''. At first you
  103. were advocating the use of quick hacks rather than tools which abstract away
  104. from the low-level. Now you are saying that since these tools make your work go
  105. faster, you are guilty of quick hacking if you use them.  Getting something
  106. done quickly is a worthwhile goal. It's called ``productivity'', and is not
  107. necessarily incompatible with other goals.
  108. -- 
  109.  
  110.